<?php

namespace app\admin\model\spell;

use think\Exception;
use think\Model;


class Comment extends Model
{





    // 表名
    protected $name = 'spell_comment';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [

    ];



    /**
     * 添加评论
     */
    public static function addInfo($orderInfo,$data)
    {
        $data = array(
            "uid"=>$orderInfo['uid'],
            "orderId"=>$orderInfo['orderId'],
            "goods"=>isset($data['goods'])?intval($data['goods']):0,
            "info"=>isset($data['info'])?$data['info']:"",
            "thumbs"=>isset($data['thumbs'])?$data['thumbs']:"",
            "express"=>isset($data['express'])?intval($data['express']):0,
            "service"=>isset($data['service'])?intval($data['service']):0,
            "status"=>1,
            "createtime"=>time(),
        );
        if(empty($data["info"])){
            throw new Exception("请留下您的意见宝意评论");
        }
        self::insert($data);
    }






}
